#include <REGX52.H>
#include <INTRINS.H>

void Delay(int time);

void main(){
	
	while(1) {
	
		if(P3_1 == 0) {
			P2_0 = 0;
			Delay(500);
			P2_0 = 1;
			Delay(500);
		} else {
			P2_0 = 1;
		}
		
	}
	
}

void Delay(int time)		//@12.000MHz
{
	unsigned char i, j;

	while(time) {
		i = 2;
		j = 239;
		do
		{
			while (--j);
		} while (--i);
		time--;
	}
}
